package dao

import (
	"order_srv/model"
	"order_srv/order"
)

func GetOrderList(PayStatus uint8) []*order.GetOrderList {
	var orders model.Order
	orders.PayStatus = PayStatus //根据支付状态获取订单列表
	list, err := orders.GetOrderList()
	if err != nil {
		panic("获取订单列表失败")

	}
	var orderList []*order.GetOrderList
	for _, o := range list {
		orderList = append(orderList, &order.GetOrderList{
			OrderId:   int64(o.Id),
			UserId:    int64(o.UserId),
			GoodSkuId: int64(o.GoodskuId),
			AddressId: int64(o.AddressId),
			RealName:  o.RealName,
			UserPhone: o.UserPhone,
			TotalNum:  o.TotalNum,
			PayType:   o.PayType,
		})
	}
	return orderList
}
